<html>
<head>
<title>Appointment Scheduling System</title>

<link href="./style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>

<div id='body_container'>
<div id="header"><div id='banner'>NITC Appoinmtent Scheduling System</div></div>
<div id='menu'>
<div id="tabs"><a href="home.php">Home</a><a href="online.php">Available Faculties</a><a href="message.php">Request Appointment</a><a href="logout.php">Logout</a></div>
</div>
<div id='page_container'>
<div id="page">
<div id="online" class='page_contents'>
<?php
error_reporting(0);
session_start();
if(isset($_SESSION['email']))
{
	$departments = array("CSE", "EEE", "ECE", "CE", "ME", "EP", "CH", "BT");
	$deptId = 1;
	if(isset($_GET['deptId']))
		$deptId = $_GET['deptId'];
	include 'dbconnect.php';
	echo "<div id='dept_sidebar'>";
	echo "<ul>";
	$deptLen = count($departments);
	for($i=0; $i<$deptLen; $i++)
		echo "<li><a href='online.php?deptId=" . ($i + 1) . "'>" . $departments[$i] . "</a></li>";
	echo "</ul></div>";
	
	$e=$_SESSION["email"];
	$qu="SELECT * FROM  faculty where onlineStat='1' and facDept=" . $deptId;
	$re=mysql_query($qu);
	$n=mysql_num_rows($re);
	echo "<div id='prof_list'>";
	echo "<div id='department_name' class='heading'>" . $departments[$deptId - 1] . " Department</div>";
	if($n>=1){
		echo "<b>Faculty members currently available in office:</b>";
		echo "<ul>";
		while ($row = mysql_fetch_array($re, MYSQL_NUM)) {
			if($row[4]==1)
    			echo "<li><span class='prof_name'>" . $row[1] . "</span></li>";  
		}
		echo "</ul>";
	}
	else
		echo "<center><b>None of the professors are online now.</b></center>";
	echo "</div>";



			

?>	
	<div class='clear'></div>
	</div>
</div>
<?php include 'footer.php'; ?>
</div>

<?php
}
else
{
header("location:index.php");
}
?>
</div>
</body>
</html>
